home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / jam / jamdisk1 / cursor / examples / primes / primes.bas next >
Encoding:
BASIC Source File  |  1995-03-18  |  501 b   |  24 lines

  1.  
  2. ' This program prints the prime-numbers from 2 to 1000 to the screen.
  3. ' The compiled program needs 16 seconds (11 seconds without PRINT-command),
  4. ' with AmigaBASIC it takes about 155 (142) seconds on my Amiga 500
  5.  
  6.  OPTION OPENWINDOW      ' Is faster than CLI-Window
  7.  OPTION ALLPCRELATIVE
  8.  DEFINT a-z
  9.  
  10.  BeginTime& = TIMER
  11.  
  12.  FOR a = 2 TO 1000
  13.    FOR b = 3 TO a-1
  14.      IF a MOD b = 0 THEN NotPrim
  15.    NEXT b
  16.    PRINT a
  17. NotPrim:
  18.  NEXT a
  19.  
  20.  PRINT "Time needed:";TIMER-BeginTime&
  21.  
  22.  WHILE INKEY$ = "" : WEND
  23.  
  24.